# from order_manager.controller.user_control import UserController
# from order_manager.view.order_ui import


class UserUI:
    def __init__(self, user_controller):
        self.user_controller = user_controller

    def login(self):
        while True:
            username = input('请输入用户名：')
            password = input('请输入密码：')
            if self.user_controller.login(username, password):
                print('登录成功')
                break
            else:
                print('登录失败')

    def logout(self):

        print(f'用户{self.user_controller.current_user}退出成功')
        self.user_controller.logout()

    def user_menu(self):
        while True:
            print('1.登录')
            print('2.退出')
            print('3.返回主界面')
            choice = input('请选择操作：')
            if choice == '1':
                self.login()
            elif choice == '2':
                self.logout()
            else:
                print('返回主界面')
                break
